function checkState()
{
	if(!System.Gadget.docked) 
	{
		undockedState();
	} 
	else if (System.Gadget.docked)
	{
		dockedState(); 
	}
}

function undockedState()
{
	gUndockFlag = true;
	with(document.body.style)
		width=800, 
		height=600;

}
////////////////////////////////////////////////////////////////////////////////
//
// styles for gadget when DOCKED
// 
////////////////////////////////////////////////////////////////////////////////
function dockedState()
{ 
	with(document.body.style)
		width=500,
		height=300;
}


function loadMain()
{
	setInterval(reload1, 1000);

	System.Gadget.settingsUI = "settings.html";
	System.Gadget.onUndock = checkState;
	System.Gadget.onDock = checkState;
}


var fso = new ActiveXObject("kod.reader"); 


function reload1()
{
   var linesToDisplay = parseInt(System.Gadget.Settings.read("linesDisplayed"));

   if (isNaN(linesToDisplay))
      linesToDisplay = 18;

   var value = fso.GetLinesAnsi(linesToDisplay);

   if (value == "")
      return;

   document.getElementById("txt").innerText = value;
   return;
}
